<template>
<view :style="theme" class="page">
	<u-loading-icon text="加载中..." textSize="18" :show="jiazai" ></u-loading-icon>
	<view class="wrap">
		<u-back-top :scroll-top="scrollTop"></u-back-top>
	</view>
	
	<u-navbar :bgColor="fenggeyanse=='light' ? '#ffffff' : '#000000'" :placeholder="true">
		<view
			class="d-kuan"
			slot="left"
		>   
		    <view class="d-zuo d-buhuanhang d-kuan">
				<u-icon
					name="arrow-left"
					size="22"
					@click="fanhui()"
				></u-icon>
				<view class="d-buhuanhang d-zuo-10 animated fadeInUp" v-if="scrollTop > 70">
					<view class="d-gaokuang-40 d-kuanggao-20 d-yuanjiao-40 d-box">
						<image v-if="tieziindex.touxiang" :src="tieziindex.touxiang" mode="aspectFill" class="d-img-26 d-yuanjiao-50 d-beijing-hui"></image>
						<image v-else src="/static/assets/images/avatar.png" mode="aspectFill" class="d-img-26 d-yuanjiao-50 d-beijing-hui"></image>
					</view>
					<view class="d-zuo-10">
						<view class="d-wenzi-14 d-jiacu d-wenzi-hei">{{tieziindex.mingcheng}}</view>
					</view>
					<view class="d-kuan-80 d-zuo-10 d-neirong-you" :id="'guanzhu'+tieziindex.uid">
						<view v-if="guanzhuuid == 1" @click="getGuanzhus(1,tieziindex.uid)" class="d-kuan-50 d-beijing-hei d-wenzi-yanse-bai-0 d-neikuang-zuoyou-2-shangxia-4 d-wenzi-12 d-yuanjiao-50 d-neirong-juzhong" >已关注</view>
						<view v-else @click="getGuanzhus(1,tieziindex.uid)" class="d-kuan-50 d-beijing-hui-f6 d-wenzi-hei d-wenzi-hei d-neikuang-zuoyou-2-shangxia-4 d-wenzi-12 d-yuanjiao-50 d-neirong-juzhong" >关 注</view>
					</view>
				</view>
				
				
			</view>
			
			
				
			
			
		</view>
		<view
			class=""
			slot="right"
		>
			<view class="d-you" >
				<!-- #ifdef MP -->
				<view class="d-you d-you-10" style="margin-right: 170rpx;">
				<!-- #endif -->
				<!-- #ifdef APP-PLUS || H5 -->
				<view class="d-you d-you-10" >
				<!-- #endif -->
					<Dxiala :localdata="options" @change="lahei($event)">
						<u-icon name="minus-people-fill" color="#c2c2c2" size="20"></u-icon>
					</Dxiala>
				</view>
				<view v-if="uid == tieziindex.uid || member['is_admin'] ==1" class="d-kuan-30-1 d-you">
					<u-icon
						name="more-dot-fill"
						size="22"
						@click="shezhishow = true"
					></u-icon>
				</view>
			</view>
		</view>
		
	</u-navbar>
	<!-- 帖子 -->
	<view v-if="tiezijiazai" class="d-kuan ">

		<!-- 标题 -->
		<view v-if="tiezineirong.title" class="d-waikuang-10 d-wenzi-hei d-wenzi-24">{{tiezineirong.title}}</view>
		<!-- 头像 -->
		<view class="d-waikuang-10 d-buhuanhang">
			<!--头像-->
			<view class="d-gaokuang-40 d-kuanggao-40 d-yuanjiao-40 d-box"  @click="getgeren(tieziindex.uid)">
				<image v-if="tieziindex.touxiang" :src="tieziindex.touxiang" mode="aspectFill" class="d-img-40 d-yuanjiao-50 d-beijing-hui"></image>
				<image v-else src="/static/assets/images/avatar.png" mode="aspectFill" class="d-img-40 d-yuanjiao-50 d-beijing-hui"></image>
				<image v-if="rzs == 1" :src="v" mode="aspectFill" class="d-img-10 d-yuanjiao-50  d-box-xia"></image>
			</view>
			<view class="d-kuan d-zuo-10 d-buhuanhang">
				<view  @click="getgeren(tieziindex.uid)">
					<view class="d-wenzi-14 d-jiacu d-wenzi-hei">{{tieziindex.mingcheng}}</view>
					<view class="d-wenzi-14 d-wenzi-yanse-hui">{{tieziindex.yonghuzu}}. {{tieziindex.guishudi}}</view>
				</view>
				
				<!-- #ifdef MP-WEIXIN-->
				<!--view v-if="uid == tieziindex.uid || member['is_admin'] ==1" class="d-zuo-10 d-kuan-30-1 d-you">
					<u-icon
						name="more-dot-fill"
						size="22"
						@click="shezhishow = true"
					></u-icon>
				</view-->
				<!-- #endif -->
				
			</view>
			<view class="d-kuan-80 d-neirong-you" :id="'guanzhu'+tieziindex.uid">
				<view v-if="guanzhuuid == 1" @click="getGuanzhus(1,tieziindex.uid)" class="d-kuan-50 d-beijing-hei d-wenzi-yanse-bai-0 d-neikuang-zuoyou-2-shangxia-4 d-wenzi-12 d-yuanjiao-50 d-neirong-juzhong" >已关注</view>
				<view v-else @click="getGuanzhus(1,tieziindex.uid)" class="d-kuan-50 d-beijing-hui-f6 d-wenzi-hei d-neikuang-zuoyou-2-shangxia-4 d-wenzi-12 d-yuanjiao-50 d-neirong-juzhong" >关 注</view>
			</view>
		</view>
		<!--招聘-->
		<view class="d-waikuang-10" v-if="zhaopin.zpkg ==1">
			<Dzhaopin
				:xinzis="zhaopin.xinzis"
				:zpyqs="zhaopin.zpyqs"
				:zhaopinbiao="zhaopin.zhaopinbiao"
				:zhaopintime="zhaopin.zhaopintime"
				:acid="zhaopin.cid"
				:aid="zhaopin.id"
				:diqua="zhaopin.diqua"
				:diqub="zhaopin.diqub"
				:diquc="zhaopin.diquc"
				:zprs="zhaopin.zprs"
				:fulilist="zhaopin.fulilist"
				:zhaopinhaoma="zhaopin.zhaopinhaoma"
				:zhaopinintime="zhaopin.zhaopinintime"
				:zhaopinuntime="zhaopin.zhaopinuntime"
				:zhaopinbiaotime="zhaopin.zhaopinbiaotime"
				:liebiao="1"
				:fabuuid="tieziindex.uid"
				:dangqianuid="uid"
				:guanliyuanuid="member"
				:keycode="keycode"
				:gongzuodizhi="zhaopin.gongzuodizhi"
				:fenggeyanse="fenggeyanse"
				@zhaodao="zhaodao"
			></Dzhaopin>
		</view>
		<!-- 内容 -->
		<view class="d-waikuang-10" v-if="unshenhe == 0">
			<u-alert :title="title" type = "warning" :show-icon="true" description = "帖子审核中..."></u-alert>
		</view>
		<view v-if="unshenhe == 1 || tiezineirong.member && tiezineirong.member.is_admin ==1">
			
			<view v-if="tiezidata.caijizhanshi ==1" class="d-waikuang-10 d-wenzi-hei d-beijing-bai">
				<!--采集-->
				<view class="d-neikuang-10 " @click="caijiurl(tiezidata.wxwzlj)">
					<view class="d-kuan ">
						<view class="d-img-caiji">
							<image :src="tiezidata && tiezidata.thumb" mode="aspectFill"  class="d-img-200-bai d-yuanjiao-6 d-yinying-10"></image>
						</view>
						<view class="d-kuan">
							{{tiezidata.jianjie}}
						</view>
					</view>
				</view>
				<!--采集-->
			</view>
			
			<view v-else class="d-waikuang-10 d-wenzi-hei">
				<jyf-parser :html="tieneirong" :use-cache="true" :selectable="true"></jyf-parser>
			</view>
			<!--视频-->
			<view class="d-zuoyou-neikuang-10" v-if="shipindata.shipin && shipindata.shipin.kaiguan == 1">
				<view  class="d-shang-10">
					<video 
					class="d-yuanjiao-10 d-kuan"
					:src="shipindata.shipin && shipindata.shipin.url"
					controls>
					</video>
				</view>
			</view>
			<!--音频-->
			<view v-if="mpsandata.kaiguan == 1" class="d-shang-10 d-zuoyou-neikuang-10">
				<block v-for="(itemmp, indexmp) in mpsandata.mp" :key="indexmp">
					<sy-audio
					isCountDown 
					:ref="'audio'+indexmp"
					:src='itemmp.url' 
					:audioCover='mpsantu' 
					subheading='' 
					:audioTitle='itemmp.title'
					@audioPlay="audioPlay('audio'+indexmp)"
					>
					</sy-audio>
					<!--view class="" @click="mpsanbofang(itemmp.title,itemmp.url)"> {{itemmp.title}}</view-->
				</block>
			</view>
			<!--九格图片-->
			<!--帖子内容图片-->
			<view class="d-zuoyou-neikuang-10">
				<view class="d-fu-kuan-10" >
					<block v-for="(itemtu, indextu) in tiezineirong.jiugetu" :key="indextu">
						<view class="d-kuan-30 d-zuo d-liangbian-10">
							<image :src="itemtu.url" mode="aspectFill" @click="showimgs(indextu)" class="d-img-100-bai d-yuanjiao-6 d-yinying-10"></image>
						</view>
					</block>
					<view class="d-clear"></view>
				</view>
			</view>
			<!--下载-->
			<view class="d-waikuang-10">
				<view class="" >
					<Dxiazai
						v-if="tiezineirong.xzzt ==1"
						:userInfo="userInfo"
						:urlzhi="1"
						:xzzt="tiezineirong.xzzt"
						:xzxz="tiezineirong.xzxz"
						:fufeixiazai = "tiezineirong.index && tiezineirong.index.fufeixiazai"
						:xiazaifujian ="tiezineirong.xiazaifujian"
						:yunxiazai="tiezineirong.yunxiazai"
						:acid="tiezineirong.cid"
						:aid="tiezineirong.id"
						:yuexia="tiezineirong.yuexia"
						@xiazaifujian="xiazaifujian"
						@fujianurl = "fujianurl"
						@yunurl="yunurl"
						@denglu="checkLogin"
						@fukuan="fukuan"
						:fenggeyanse="fenggeyanse"
					></Dxiazai>
				</view>
			</view>
			<view class="d-waikuang-10">
				<view class="d-kuan d-yuanjiao-10 d-shangxia-neikuang-10">
					<!--问答进度条-->
					<view v-if="wenda.wendakaiguan ==1" class="d-neikuang-10 d-shang-10  d-yuanjiao-10 " :style="[{'background-color': fenggeyanse =='light'? '#fff4f4':'#242424'}]">
						<u-divider-d
								text="问答求助"
								textColor="#cf1212"
								:lineColor="fenggeyanse =='light'? '#fff4f4':'#242424'"
								ico="chat"
								color="#cf1212"
						></u-divider-d>
						<u-steps :current="wenda.wenda" :beijing="fenggeyanse =='light'? '#fff4f4':'#242424'" :inactiveColor="fenggeyanse =='light'? '#ff9346':'#f5f5f5'" activeColor="#ff702e">
							<u-steps-item title="提问中" :desc="wenda.tiwentime"></u-steps-item>
							<u-steps-item title="已解答" :desc="wenda.yijietime"></u-steps-item>
						</u-steps>
					</view>
					<!--需求进度条-->
					<view v-if="jindu.xuqiukaiguan ==1" class="d-neikuang-10 d-shang-10  d-yuanjiao-10 " style="background-color: #f5f9ff;">
						<u-steps :current="jindu.xuqiu" beijing="#f5f9ff" inactiveColor="#adadad" >
							<u-steps-item title="提需求" :desc="jindu.tixuqiutime" ></u-steps-item>
							<u-steps-item title="排期中" :desc="jindu.paixuqiutime" @click.native="jinduleixing(2)"></u-steps-item>
							<u-steps-item title="在开发" :desc="jindu.kaifaxuqiutime" @click.native="jinduleixing(3)"></u-steps-item>
							<u-steps-item title="已上线" :desc="jindu.wangchengxuqiutime" @click.native="jinduleixing(4)"></u-steps-item>
						</u-steps>
					</view>
					<!--缺点修复进度-->
					<view v-if="jindu.bugkaiguan ==1" class="d-neikuang-10 d-shang-10  d-yuanjiao-10 " style="background-color: #eefffa;">
						<u-steps :current="jindu.bugs" beijing="#eefffa" activeColor="#5eb295" inactiveColor="#adadad">
							<u-steps-item title="发现BUG" :desc="jindu.tibugtime"></u-steps-item>
							<u-steps-item title="排期中" :desc="jindu.paixubugtime" @click.native="bugleixing(2)"></u-steps-item>
							<u-steps-item title="在开发" :desc="jindu.kaifabugtime" @click.native="bugleixing(3)"></u-steps-item>
							<u-steps-item title="已修复" :desc="jindu.wangchengbugtime" @click.native="bugleixing(4)"></u-steps-item>
						</u-steps>
					</view>
				</view>
			</view>
		
		
			<!--点赞分享-->
			<view class="d-waikuang-10">
				<u-row justify="space-between">
					<u-col span="4">
						<view class="demo-layout bg-purple"></view>
					</u-col>
					<u-col span="4">
						<view class="d-kuan d-zyouyou-juzhong">
							<view class="d-bian-1 d-yuanjiao-50 d-neikuang-5 d-buhuanhang" @click="getZan(tieids,uid)">
								<view class="d-zuo-10 d-you-10 d-wenzi-hei">{{dianzanshu}}</view>
								<u-icon :name="dianzan" color="#ea521f" size="20"  labelPos="bottom" labelSize="12"></u-icon>
							</view>
						</view>
					</u-col>
					<u-col span="4">
						<view class="demo-layout bg-purple"></view>
					</u-col>
				</u-row>
			</view>
		
			<view class="d-waikuang-10" v-if="dianzandata.length > 0">

				<u-row justify="space-between">
					
					<u-col span="12">
						<view class="d-kuan d-zyouyou-juzhong">
							
							<view class="d-touxiang-10" v-for="(item, index) in dianzandata" :key="index">
								<u-avatar :src="item.touxiang" fontSize="22" size="20" ></u-avatar>
							</view>

						</view>
					</u-col>
					
				</u-row>
			</view>
		</view>
		<u-gap height="50" :bgColor="fenggeyanse=='light' ? '#f9f9f9' : '#000000'" ></u-gap>
		<view v-if="quanzishuxing['mianzekaiguan'] == 1" class="d-waikuang-10">
			<view class=" d-wenzi-12 d-beijing-hui-f6 d-wenzi-yanse-hui d-yuanjiao-10 d-neikuang-10 ">
				{{quanzishuxing['mianzeneirong']}}
			</view>
		</view>
		<!--举报-->
		<u-row justify="space-between">
			<u-col span="6">
				<view class="d-kuan-140">
					<view class="d-zuo-10 d-bian-1 d-yuanjiao-50 d-neikuang-5 d-buhuanhang" @click="getQuan(tiezineirong.index.quanid)">
						<u-icon name="map" color="#c8c8c8" size="20"  labelPos="bottom" labelSize="12"></u-icon>
						<view class="d-zuo-10 d-you-10 d-chaochu-1 d-wenzi-yanse-hui d-wenzi-14">{{tiezineirong.index && tiezineirong.index.quantitle}}</view>
					</view>
				</view>
			</u-col>
			<u-col span="6">
				<view class="d-kuan">
					<view class="d-kuan-70" style="float: right;justify-content: flex-end;">
						<u-icon name="bell" color="#919191" label="举报" size="28" @click="jubaoopen()"></u-icon>
					</view>
				</view>
			</u-col>
		</u-row>
		<!--微信客服-->
		<view class="d-kuan " v-if="weixinkefu.pages && weixinkefu.pages.zongkg ==1">
			<view class="d-waikuang-10 ">
				<view class="d-kuan d-yuanjiao-10 d-beijing-bai d-bian-1">
					<view class="d-neikuang-10">
						<view class="d-kuan d-buhuanhang" @click="kefu()">
							<view class="d-zuo-5">
								<image :src="weixinkefu.kefutu" class="d-img-40"></image>
							</view>
							<view class="d-hanggao-40 d-zuo-10">
								<text class="d-wenzi-hei">在线客服</text>
								<text class="d-zuo-10 d-wenzi-12 d-wenzi-yanse-hui">有疑问，需咨询</text>
							</view>
						</view>
						<view class="d-clear"></view>
					</view>
				</view>
			</view>
		</view>
		<u-popup :show="jubaoshow" mode="bottom" :round="10" @close="jubaoclose" @open="jubaoopen" >
			<view style="height: 240px;">
				<view class="d-waikuang-10">
					<view class="">
						<uni-forms
							:modelValue="jubaoData" 
							label-position="top"
						>
							<u-cell icon="bell" title="帖子举报" value="填写内容"></u-cell>
							<u--textarea v-model="jubaoData.neirong" placeholder="请输入内容" ></u--textarea>
							<view class="d-shang-10">
							<u-checkbox-group v-model="jubaoData.leixing" placement="row" @change="checkboxChange">
								<u-checkbox
									:customStyle="{marginBottom: '8px',paddingRight:'10px'}"
									v-for="(item, index) in jubaoList"
									:key="index"
									:label="item.name"
									:name="item.name"
									:disabled="item.disabled"
									:value="index"
								>
								</u-checkbox>
							</u-checkbox-group>
							</view>
							<view class="d-shang-10">
								<u-button type="primary" text="提交" @click="postJubaodata(tiezineirong.id)"></u-button>
							</view>
						</uni-forms>
						
					</view>
				</view>
			</view>
		</u-popup>
		<!--问答列表-->
		<Dwendadaan 
			v-if="wenda.wendakaiguan ==1"
			:postsList="postsList"
			:wendadata="wendadata"
			:tieziindex="tieziindex"
			:tieids = "tieids"
			:uid = "uid"
			:adminuid="member.is_admin"
			@getWendajianglidata="getWendajianglidata"
			@getdaan="getdaan"
			@daantiezi="daantiezi"
		>
		</Dwendadaan>
		<!--问答列表-->
		<!--评论-->
		<view v-if="wenda.wendakaiguan !=1" :style="{'background-color': fenggeyanse =='light'? '#f9f9f9':'#2b2b2b'}">
			<view class="d-waikuang-10" v-if="unshenhe == 0">
				<view v-if="tiezineirong.member && tiezineirong.member.is_admin ==1">
					<u-tabbar
						:value="shehea"
						@change="shenhe"
						:fixed="true"
						:placeholder="false"
						:safeAreaInsetBottom="false"
					>
						<u-tabbar-item text="返回" icon="arrow-left" @click="fanhui()"></u-tabbar-item>
						<u-tabbar-item text="审核通过" icon="checkmark"></u-tabbar-item>
					</u-tabbar>
				</view>
			</view>
			<view v-else>
				<d-comment
					ref="hbComment" 
					@add="add" 
					@del="del" 
					@like="like"
					@getZan="getZan" 
					@getShoucang="getShoucang" 
					@focusOn="focusOn"
					@pingluncontent="pingluncontent"
					@lahei="laheidata"
					:keycode="keycode"
					:shipinhuifudata="shipinhuifudata"
					:pingluntongji="pingluntongji"
					:tieziindex="tieziindex"
					:deleteTip="'确认删除？'"
					:cmData="tiezi" 
					:dianzan="dianzan"
					:shoucang="shoucang"
					:domain="domain"
					v-if="tiezi"
					:fenggeyanse="fenggeyanse"
				>
				</d-comment>
			</view>
			<!--xia50-->
			
		</view>
		<view v-if="wenda.wendakaiguan ==1 && wenda.wenda==0">
			<u-tabbar
				:value="wendatijiao"
				@change="wendatijiaochange"
				:fixed="true"
				:placeholder="true"
				:safeAreaInsetBottom="true"
				activeColor="#ff9346"
			>
				<u-tabbar-item text="提交答案" icon="plus-circle"  @click="wendatijiaodata(tieids,qid)" ></u-tabbar-item>
			</u-tabbar>
		</view>
		<u-gap height="100" :bgColor="fenggeyanse=='light' ? '#f9f9f9' : '#2b2b2b'" ></u-gap>

	<view>

	<u-modal 
		:show="shenheshow" 
		cancelText="取消" 
		confirmText="确认"
		:showCancelButton="true" 
		title="审核帖子" 
		content='确认核对通过' 
		@cancel="shenheguanbi"
		@confirm="shenhequerren"
	></u-modal>
	

	<view class="ditail-copyright" :style="'display:' + display">
		<block data-type="template" data-is="tempCopyright" data-attr="webSiteName:webSiteName,domain:domain">
			<view> {{webSiteName}} </view>
		</block>
	</view>

	<!-- 无法访问网络时 -->
	<view class="showerror" :style="'display:' + showerror">
		<!--image src="/static/images/cry80.png" style="height:100rpx;width:100rpx"></image-->
		<view class="errortext">{{errMessage}}</view>
	</view>

</view>
</view>
    <!--设置-->
	<u-popup :show="shezhishow" @close="shezhiclose" @open="shezhiopen" round="10" mode="top" >
		<Dshezhi
		    :fenggeyanse="fenggeyanse"
		    :bugkaiguan="jindu.bugkaiguan"
		    :xuqiukaiguan="jindu.xuqiukaiguan"
			:quanzhiding="jindu.zhiding"
			:tiejinghua="jindu.jinghua"
			:shouyetuijian="jindu.tuijian"
			:quanzhanqzzd="jindu.qzzd"
			:shenhe="jindu.shenhe"
			@bug="bug"
			@xuqiu="xuqiu"
			@quanzhidingdata="quanzhidingdata"
			@quanshouyedata="quanshouyedata"
			@quanjinghuadata="quanjinghuadata"
			@quanzhanzhidingdata="quanzhanzhidingdata"
			@shenhequerren="shenhequerren"
			@shanchu="shanchu"
			@bianjidata="bianjidata"
		>
		</Dshezhi>
		
	</u-popup>

</view>
</template>

<script>

import config from "../../utils/config";
import Dxiazai from "@/components/d-xiazai/d-xiazai";  //引入组件
import Dzhaopin from "@/components/d-zhaopin/d-zhaopin";  //引入组件
import Dwendadaan from "@/components/d-wendadaan/d-wendadaan";  //引入组件
import Dshezhi from "@/components/d-shezhi/d-shezhi";  //引入组件
import Dcomment from "@/components/d-comment/d-comment";  //引入组件
import Dxiala from "@/components/d-xiala/d-xiala";  //引入组件

var Api = require("../../utils/api.js");
var util = require("../../utils/util.js");

var wxApi = require("../../utils/wxApi.js");
var wxRequest = require("../../utils/wxRequest.js");
const innerAudioContext = uni.createInnerAudioContext();
let isFocusing = false;
const pageCount = config.getPageCount;
var webSiteName = config.getWebsiteName;
var domain = config.getDomain;
var defaultskin = config.getskin;
let rewardedVideoAd = null;
var wss = config.getWss;

export default {
  data() {
    return {
      detail: {
        content: {
          rendered: ""
        },
        title: {},
        acf: {}
      },
      content: {
        rendered: ""
      },
      title: '',
      acf: {},
      defaultskin: defaultskin,
      skin: defaultskin,
      //title: '文章内容',
      webSiteName: webSiteName,
      html: " ",
      detailDate: '',
      display: 'none',
      showerror: 'none',
      page: 1,
      isLastPage: false,
      parentID: "0",
      scrollHeight: 0,
      xiangguan: [],
      link: '',
      dialog: {
        title: '',
        content: '',
        hidden: true
      },
      content: '',
      flag: 1,
	   tagStyle: {
	      img: "height:auto!important;display:block"
	    },
      enableComment: true,
      isLoading: false,
      total_comments: 0,
      //userInfo: {},
      shareImagePath: '',
      fristOpen: false,
      domain: domain,
      platform: '',
      tagStyle: {},
      errMessage: "",
      commentCount: "",
      likeCount: "",
      postID: "",
      postImageUrl: "",
      commentsList: "",
      article_article: "",
	  tiezi: [],
	  tieziindex:{},
	  tiezineirong: {},
	  jiazai:true,
	  tiezijiazai:false,
	  pinglun: [],
	  pingluntongji: 0,
	  tieids: '',
	  "reqFlag": false , // 请求标志，防止重复操作，true表示请求中
	  member:[],
	  userInfo: '',
	  memberuid: '',
	  dianzan:'',
	  shoucang:'',
	  pingluncontents:'',
	  tieneirong:'',
	  rzs:'',
	  v:config.getDomain+'/static/default/web/img/V.png',
	  tieziuid:'',
	  guanzhuuid:'',
	  jindu:[],
	  jubaoshow :false,
	  jubaoData:{},
	  jubaotitle:'',
	  jubaoList: [{
		      id:1,
			  name: '广告',
			  disabled: false
		  },
		  {
			id:2,
			  name: '重复',
			  disabled: false
		  },
		  {
			  id:3,
			  name: '低俗',
			  disabled: false
		  },
		  {
			  id:4,
			  name: '夸张',
			  disabled: false
		  }
		  
	  ],
	  uid:'',
	  tongji:{},
	  jubaoshuju:{},
	  jubaoxuanzedata:{},
	  qid:'',
	  scrollTop: 0,
	  bgColor: '#ffffff',
	  dianzanshu:'0',
	  dianzandata:{},
	  shehea:0,
	  shenheshow:false,
	  keycode:'',
	  unshenhe:'1',
	  wenda:{},
	  postsList:[],
	  wendakaiguan:'',
	  wendatijiao:0,
	  keycode:'',
	  zhaopin:{},
	  wendadata:{},
	  shezhishow: false,
	  shezhilist:[
		{
			name: 'error-circle',
			title: 'BUG帖'
			},
			{
			  name: 'clock',
			  title: '进度帖'
			},
			{
			  name: 'arrow-upward',
			  title: '圈子置顶'
			},
			{
			  name: 'arrow-upward',
			  title: '首页置顶'
			},
			{
			  name: 'star',
			  title: '精华帖'
			},
			{
			  name: 'arrow-up-fill',
			  title: '全站置顶'
			},
			{
			  name: 'checkbox-mark',
			  title: '已经核对'
			},
			{
			  name: 'checkbox-mark',
			  title: '删除帖子'
			},
			{
			  name: 'edit-pen-fill',
			  title: '编辑帖子'
			},
	    ],
		shipinhuifudata:true,
		weixinkefu:[],
		shipindata:[],
		www: {},
		quanzishuxing:[],
		fenggeyanse:'',
		mpsandata:[],
		mpsantu:config.getDomain+'/static/default/web/img/mpsan.png',
		mpsanshow: false,
		mpsanurl:'',
		mpsantitle:'',
		fenxiangtu:{},
		yonghuXinxi: [],
		quanid:'',
		jiaru:'',
		duankou:'',
		tiezidata:{},
		// 右边菜单内容
		options: [
			{
				value: '',
				zhi:'1',
				text: '拉黑此用户'
			},
			{
				zhi:'2',
				value: '',
				text: '屏蔽此帖子'
			}
		]
    };
  },

  components: {
	  Dxiazai,
	  Dzhaopin,
	  Dwendadaan,
	  Dshezhi,
	  Dcomment,
	  Dxiala
	  
  },
  props: {},
  onPageScroll(e) {
  	this.scrollTop = e.scrollTop;
	//console.log("scrollTop",e.scrollTop);
  },
  onShow: function (options) {
    var that = this;
    var skin = uni.getStorageSync('skin');

    if (skin != '') {
      that.setData({
        skin: skin
      });
    }
	var duixin = this;
	//判断用户是否登录
	var userInfo = uni.getStorageSync('userInfo');
	
	var member = uni.getStorageSync('member');
	if (userInfo) {
	  		  this.getTongjis(this.uid);
	  		  this.getimin(this.uid,member);
			
	}
	duixin.getWendadlist(duixin.tieids,duixin);
	
	  // 暗黑模式
	var initialThemes = uni.getStorageSync('theme');
	
	if(!initialThemes){
		duixin.fenggeyanse = 'light';
		uni.setStorageSync('theme', 'light');
	} else {
		duixin.fenggeyanse = initialThemes;
	}
	//console.log("fenggeyanse",duixin.fenggeyanse);
	uni.setNavigationBarColor({
		backgroundColor: this.fenggeyanse =='light'? '#ffffff':'#151515',
		frontColor: this.fenggeyanse =='light'? '#000000':'#ffffff',
	})

  },
  onLoad: function (options) {
	  
    var duixin = this;
	
	duixin.tieids = options.id;
	duixin.qid = options.qid;
	duixin.getDangqianurl();//获取当前网址
	duixin.getWeixinkefuData();
	duixin.getWww(); // 网站信息
	duixin.duankoudata(); // 判断端口
	/*#ifdef H5*/
	var duixin = this;
	
	/*#endif*/
	
	duixin.getQuanzishuxingData();
	//duixin.gundong();
    var skin = uni.getStorageSync('skin');
	//判断用户是否登录
	var userInfo = uni.getStorageSync('userInfo');
	var keycode = uni.getStorageSync('keycode');
	duixin.keycode = keycode;
	//console.log("options",options);
	if (userInfo) {
		var member = uni.getStorageSync('member');
		var memberuid = uni.getStorageSync('memberuid');
		duixin.member = member;
		duixin.userInfo = userInfo;
		duixin.memberuid = memberuid;
		duixin.uid = memberuid;
		duixin.getimin(memberuid,member);
		duixin.getYonghuXinxi(duixin.uid);
	}
	
	//duixin.getTieziid(options.qid,options.id,memberuid,userInfo);
	duixin.getPinglunNeirong(options.id,memberuid,userInfo);
	duixin.getTiezineirong(options.id,memberuid,userInfo);
	//console.log('duixin.tieziindex000: ',duixin.tieziindex);
	
	duixin.shiminghuifu();
	
	
	duixin.getJindus(options.id);
	duixin.getZanzhi(options.id);
	
	duixin.getShoucangzhi(options.id);
	
    duixin.getWendadata(options.id);
	
	duixin.getZhaopindata(options.id);
	//console.log('duixin.wendakaiguan: ',duixin.wendakaiguan);
	//duixin.getWendadlist(options.id,duixin);

	duixin.getDianzantongjideta();
	duixin.getShipinData();
	duixin.getMpsanData();

	
	
    if (skin != '') {
      duixin.setData({
        skin: skin
      });
    }
	
	
  },
  onUnload: function () {},
  //分享到个人朋友圈
  onShareAppMessage: function (res) {
	  var duixin = this;
    return {
      title: this.tiezineirong.title,
      path: 'pages/tiezi/tiezi?id=' + this.tiezineirong.index.id + '&qid=' + this.tiezineirong.index.cid,
      //imageUrl: duixin.www['logo'],
      success: function (res) {
        // 转发成功
        //console.log(res);
      },
      fail: function (res) {
        //console.log(res); // 转发失败
      }
    };
  },
  //分享到朋友圈
  onShareTimeline: function (res) {
	  var duixin = this;
  	  return {
  	    title: this.tiezineirong.title,
  	    path: 'pages/tiezi/tiezi?id=' + this.tiezineirong.index.id + '&qid=' + this.tiezineirong.index.cid,
		//imageUrl: duixin.www['logo'],
  	    success: function (res) {// 转发成功
  	    },
  	    fail: function (res) {// 转发失败
  	    }
  	  };
  },
  methods: {
	  
	linkpress(attrs){
		console.log('复制url',attrs.href);
		wx.setClipboardData({
		    data: '需要复制的内容',
		    success(res) {
		        wx.showModal({
		            title: '提示',
		            content: '内容已复制到粘贴板',
		            showCancel: false
		        })
		    }
		});
	},
    BackPage() {
      uni.navigateBack({
        delta: 1
      });
    },
	fanhui() {
		const pages = getCurrentPages();  //判断跳转了多少页
		if (pages.length === 2) {  
			uni.navigateBack({
				delta: 1
			});
		} else if (pages.length === 1) { //如果没有上一页返回首页
			uni.switchTab({
				url: '/pages/index/index',
			})
		} else {
			uni.navigateBack({
				delta: 1
			});
		}
		
	},

    toHome() {
      uni.reLaunch({
        url: '/pages/index/index'
      });
    },

    gotowebpage: function () {
      var self = this;
      var url = '../webpage/webpage';
      uni.navigateTo({
        url: url + '?url=' + self.link
      });
    },
    copyLink: function (url) {
      uni.setClipboardData({
        data: url,
        success: function (res) {
          uni.getClipboardData({
            success: function (res) {
              uni.showToast({
                title: '链接已复制',
                image: "/static/images/uploads/link.png",
                duration: 2000
              });
            }
          });
        }
      });
    },
    copyText: function (e) {
      console.log(e);
      uni.setClipboardData({
        data: e.currentTarget.dataset.text,
        success: function (res) {
          uni.getClipboardData({
            success: function (res) {
              uni.showToast({
                title: '复制成功'
              });
            }
          });
        }
      });
    },
    gourl: function () {
      var url = '../webpage/webpage';
      uni.navigateTo({
        url: url + '?url=' + e.currentTarget.dataset.text
      });
    },
    goHome: function () {
      uni.switchTab({
        url: '../index/index'
      });
    },
    //获取是否开启评论设置
    getEnableComment: function (id) {
      var self = this;
      var getEnableCommentRequest = wxRequest.getRequest(Api.getEnableComment());
      getEnableCommentRequest.then(response => {
        if (response.data.enableComment != null && response.data.enableComment != '') {
          if (response.data.enableComment === "1") {
            self.setData({
              enableComment: true
            });
          } else {
            self.setData({
              enableComment: false
            });
          }
        }

        ;
      });
    },
	//获取帖子内容
	getTieziid(quanid,tieid,uid,code) {
		
		var self = this;
		self.setData({
		    tiezi: []
		});
		var getTieidRequest = wxRequest.getRequest(Api.getTieid(quanid,tieid,uid,code));
		var res;
		getTieidRequest.then(response => {
			res = response;
			//console.log("帖子",res.data.data.son_tie);
			if(res.data.code) {
				self.jiazai = false;
				self.tiezijiazai = true;
				self.tiezi = res.data.data.son_tie
			} else {
			  uni.showToast({
			  	icon: 'none',
			  	title: '获取失败，请稍后重试'
			  });
			}
		})
	},
	//获取帖子评论内容
	getPinglunNeirong(tieid,uid,code) {
		//console.log("帖子id",tieids);
		var self = this;
		var duixin = this;
		self.setData({
		    tiezi: []
		});
		var getPinglunNeirongRequest = wxRequest.getRequest(Api.getPinglunNeirong(tieid,uid,code));
		var res;
		getPinglunNeirongRequest.then(response => {
			res = response;
			//console.log("帖子",res.data.data.son_tie);
			if(res.data.code) {
				self.jiazai = false;
				self.tiezijiazai = true;
				self.tiezi = res.data.data.list;
				duixin.tiezidata = res.data.data;
				self.pingluntongji = res.data.data.comments;
				//console.log("帖子tiezi",res.data.data)

			} else {
			  if(res.data.msg=="账号必须实名认证"){
			  	uni.showModal({
			  		title: res.data.msg,
			  		//content: '请先登录',
			  		confirmText: '前往认证',
			  		success: function(res) {
			  			if (res.confirm) {
			  				uni.navigateTo({
			  					url: '/pages/shezhi/renzheng'
			  				});
			  			}
			  		}
			  	});
			  } else if (response.data.msg=="账号必须上传头像"){
				  uni.showModal({
				  	title: response.data.msg,
				  	//content: '请先登录',
				  	confirmText: '前往上传',
				  	success: function(res) {
				  		if (res.confirm) {
				  			uni.switchTab({
				  				url: '/pages/wo/wo'
				  			});
				  		}
				  	}
				  });
			  } else {
			  	uni.showToast({
			  		icon: 'none',
			  		title: '获取失败，请稍后重试'
			  	});
			  }
			}
		})
	},
	//判断是否有上一页
	shangyiye(){
		const pages = getCurrentPages();  //判断跳转了多少页
		if (pages.length === 2) {  
			uni.navigateBack({
				delta: 1
			});
		} else if (pages.length === 1) { //如果没有上一页返回首页
			uni.switchTab({
				url: '/pages/index/index',
			})
		} else {
			uni.navigateBack({   
				delta: 1    
			});
		}
	},
	//获取帖子内容
	getTiezineirong(tieid,uid,code) {
		//console.log("帖子id",tieids);
		var self = this;
		var duixin = this;
		self.setData({
		    pinglun: []
		});
		var getTiezineirongRequest = wxRequest.getRequest(Api.getPinglunNeirong(tieid,uid,code));
		var res;
		getTiezineirongRequest.then(response => {
			res = response;
			if(res.data.code) {
				self.tiezineirong = res.data.data;
				self.unshenhe = res.data.data.index && res.data.data.index.shenhe;
				self.tieneirong = res.data.data.index && res.data.data.index.neirong;
				if(res.data.data.title){
					self.jubaotitle = res.data.data.title;
				} else {
					self.jubaotitle = res.data.data.index && res.data.data.index.neirong;
				}
				//console.log("self.jubaotitle",self.jubaotitle);
				//console.log("tiezineirong.yunxiazai",self.tiezineirong && self.tiezineirong.yunxiazai);
				//console.log("tiezineirong",res.data.data.index.neirong);
				let tieziindexs = {
					"id": res.data.data.id,
					"touxiang": res.data.data.touxiang,
					"mingcheng": res.data.data.mingcheng,
					"yonghuzu": res.data.data.yonghuzu,
					"guishudi": res.data.data.guishudi,
					"comments": res.data.data.comments,
					"uid": res.data.data.uid
				}
				self.tieziuid = res.data.data.uid;
				//console.log('tieziuid: ',self.tieziuid);
				self.tieziindex = tieziindexs;
				duixin.options[0].value = tieziindexs.uid; //拉黑用户
				duixin.options[1].value = tieziindexs.id; //屏蔽帖子
				self.getGerenGuanzhus(res.data.data.uid);
				self.getRenzheng(res.data.data.uid);
				var jiaru = res.data.data.index && res.data.data.index.jiaru;
				var quan = res.data.data.quan;
				if(jiaru==0){
					
					uni.showModal({
					title: '加入圈子后才能阅读',
					//content: '您的余额： 元',
					cancelText: '返回圈子',//取消按钮的文字
					confirmText: '确定加入',
						success: function(res) {
							if(res.confirm){
								//duixin.jiaru = 1;
								duixin.postJiaruquanzidata();
							} else if (res.cancel) { //点击取消之后执行的代码
							    duixin.shangyiye();
							}
						}
					});
				} else if(jiaru==2) {
					if(duixin.yonghuXinxi.money >= quan.price){
						uni.showModal({
						title: '付费加入'+quan.price+ ' 元',
						content: '您的余额：'+duixin.yonghuXinxi.money+' 元',
						cancelText: '返回圈子',//取消按钮的文字
						confirmText: '确定加入',
							success: function(res) {
								if(res.confirm){
									duixin.jiaru = 1;
									duixin.getfufeijiaruqian();
								} else if (res.cancel) { //点击取消之后执行的代码
								    duixin.shangyiye();
								}
							}
						});
					} else{
						uni.showModal({
						title: '付费加入',
						content: '支付 '+quan.price + ' 元 ' + quan.tianshu +' 天',
						cancelText: '返回圈子',//取消按钮的文字
						showCancel: true,// 是否显示取消按钮，默认为 true
						confirmText: '去充值',
							success: function(res) {
								if(res.confirm){
									if(duixin.duankou){
										duixin.getFanhuiurl();
										uni.redirectTo({
											url: '/pages/chongzhi/chongzhi'
										});
									} else {
										uni.showToast({
											icon: 'none',
											title: 'IOS暂时不支持充值',
											duration: 1000
										});
									}
									
								} else if (res.cancel) { //点击取消之后执行的代码
								    duixin.shangyiye();
								}
							}
						});
					}
					
					
					
				} else if(jiaru==3) {
					uni.showModal({
					title: '待加入',
					content: '您已经支付',
					cancelText: '返回圈子',//取消按钮的文字
					confirmText: '确定加入',
						success: function(res) {
							if(res.confirm){
								//duixin.jiaru = 1;
								duixin.getfufeijiaruqian();
								duixin.getTiezineirong(duixin.tieids,duixin.uid,duixin.keycode);
							} else if (res.cancel) { //点击取消之后执行的代码
							    duixin.shangyiye();
							}
						}
					});
				} else if(jiaru==4) {
					uni.showModal({
					title: '您加入的圈子已经到期',
					content: self.tieneirong,
					cancelText: '返回圈子',//取消按钮的文字
					confirmText: '确定加入',
						success: function(res) {
							if(res.confirm){
								//duixin.jiaru = 1;
								duixin.getfufeijiaruqian();
								
							} else if (res.cancel) { //点击取消之后执行的代码
							    uni.navigateBack({
									delta:1,//返回层数，2则上上页
								})
							}
						}
					});
				}
				//console.log("tieziindex",self.tieziindex);
			} else {
				if(res.data.msg=="账号必须实名认证"){
					
				} else if (response.data.msg=="账号必须上传头像"){
				  uni.showModal({
				  	title: response.data.msg,
				  	//content: '请先登录',
				  	confirmText: '前往上传',
				  	success: function(res) {
				  		if (res.confirm) {
				  			uni.switchTab({
				  				url: '/pages/wo/wo'
				  			});
				  		}
				  	}
				  });
				} else {
					uni.showToast({
						icon: 'none',
						title: '获取失败，请稍后重试'
					});
				}
			  
			}
		})
	},
	//加入圈子
	postJiaruquanzidata() {
		var duixin = this;
		if(duixin.keycode){
			var postJiaruquanziRequest = wxRequest.getRequest(Api.postJiaruquanzi(duixin.uid,duixin.keycode,duixin.qid));
			var res;
			postJiaruquanziRequest.then(response => {
				res = response;
				if(res.data.msg == "加入圈子") {
					duixin.jiaru = 1;
					duixin.getTiezineirong(duixin.tieids,duixin.uid,duixin.keycode);
					uni.showToast({
						title: res.data.msg,
						icon: 'success',
						duration: 2000
					});
				}
				if(res.data.msg == "退出圈子") {
					duixin.jiaru = 0;
					uni.showToast({
						title: res.data.msg,
						icon: 'success',
						duration: 2000
					});
				}
				if(res.data.msg=="账号必须实名认证"){
					uni.showModal({
						title: res.data.msg,
						//content: '请先登录',
						confirmText: '前往认证',
						success: function(res) {
							if (res.confirm) {
								uni.navigateTo({
									url: '/pages/shezhi/renzheng'
								});
							}
						}
					});
				} 
				if(!duixin.keycode){
					uni.showModal({
					title: '请先登录',
					//content: '请先登录',
					confirmText: '前往登录',
					success: function(res) {
						if (res.confirm) {
							uni.redirectTo({
								url: '/pages/login/login'
							});
						}
					}
					});
				}
				if(res.data.code == 2) {
					uni.showToast({
						title: res.data.msg,
						icon: 'none',
						duration: 2000
					});
				}
			})
		} else {
			//否则跳转到登录页面
			uni.navigateTo({
				url: '/pages/login/login'
			});
		}
		
	},
	//支付后返回当前页面
	getFanhuiurl() {
		//获取当前页面栈的实例
		let pages = getCurrentPages();
		//获取当前页面
		let currentPage = pages[pages.length-1].$page.fullPath;
		let url = currentPage;
		uni.setStorageSync('fanhuiurl', url);
		
		
	},
	// 使用余额付费加入
	getfufeijiaruqian(){
		var duixin = this;
		//console.log('xx'); 
		var getFufeijiaquanRequest = wxRequest.getRequest(Api.getFufeijiaquan(duixin.uid,duixin.keycode,duixin.qid));
		getFufeijiaquanRequest.then(response => {
			if (response.data.code == 1) {
				  if(response.data && response.data.data && response.data.data.code==1){
					  duixin.jiaru = 1;
					  duixin.getTiezineirong(duixin.tieids,duixin.uid,duixin.keycode);
					  console.log('xx'); 
				  }
				  uni.showToast({
					icon: 'none',
					title: response.data && response.data.data && response.data.data.msg,
					duration: 2000
				  });
			  
			} else {
			  uni.showToast({
				icon: 'none',
				title: response.data && response.data.data && response.data.data.msg,
				duration: 2000
			  });
			}
		});
		
		
	},
    //获取文章内容
    fetchDetailData: function (id) {
      var self = this;
      var getPostDetailRequest = wxRequest.getRequest(Api.getShowUrl(id));
      var res;
      getPostDetailRequest.then(response => {
        res = response;
		//console.log(res);
        if (response.data.data.code == 0 && response.data.data.status == "404") {
          self.setData({
            showerror: 'block',
            display: 'none',
            errMessage: response.data.message
          });
          return false;
        } // 设置页面标题：文章分类


        uni.setNavigationBarTitle({
          // title: res.data.title.rendered
          title: res.data.data.title
        });
        //WxParse.wxParse('article', 'html', response.data.content.rendered, self, 5)
        setTimeout(() => {
          self.article_article = response.data.data.content;
        }, 200);


        ;
        var _likeCount = response.data.like_count;
        self.setData({
          detail: response.data.data,
          likeCount: _likeCount,
          postID: id,
          link: response.data.data.link,
          detailDate: response.data.data.updatetime,
          display: 'block',
          total_comments: response.data.data.hits,
          postImageUrl: response.data.postImageUrl
        });
        return response.data;
      }).then(response => {
       
      }).catch(function (error) {
        console.log('error: ' + error);
      });
    },
    //拖动进度条事件
    //给a标签添加跳转和复制链接事件
    wxParseTagATap: function (e) {
      var self = this;
      var href = e.currentTarget.dataset.src;
      //console.log(href);
      var domain = config.getDomain; //可以在这里进行一些路由处理

      if (href.indexOf(domain) == -1) {
        uni.setClipboardData({
          data: href,
          success: function (res) {
            uni.getClipboardData({
              success: function (res) {
                uni.showToast({
                  title: '链接已复制',
                  //icon: 'success',
                  image: "/static/images/uploads/link.png",
                  duration: 2000
                });
              }
            });
          }
        });
      } else {
        var slug = util.GetUrlFileName(href, domain);

        if (slug == 'index') {
          uni.switchTab({
            url: '../index/index'
          });
        } else {
          var getPostSlugRequest = wxRequest.getRequest(Api.getPostBySlug(slug));
        }
      }
    },
	//个人关注判断
	getGerenGuanzhus(touid) {
		var duixin = this;
		//console.log('touid: ',touid);
		//var touid = duixin.tieziindex['uid'];
		var getGerenGuanzhuRequest = wxRequest.getRequest(Api.getGerenGuanzhu(duixin.memberuid,duixin.userInfo,touid));
		var res;
		getGerenGuanzhuRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.data.guanzhuuid == 1) {
					duixin.guanzhuuid = res.data.data.guanzhuuid;
				} else {
					duixin.guanzhuuid = 0
				}
				
			}
		})
		
	},
	//关注
	getGuanzhus(index,uid) {
		var duixin = this;
		var getGuanzhuRequest = wxRequest.getRequest(Api.getGuanzhu(duixin.memberuid,duixin.userInfo)+'&uid='+uid);
		var res;
		getGuanzhuRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.data.status == 1) {
					duixin.guanzhuuid = 1;
					
					uni.showToast({
						title: res.data.msg,
						icon: 'success',
						duration: 2000
					});
					
				} else {
					duixin.guanzhuuid = 0;
					
					uni.showToast({
					  title: res.data.msg,
					  mask: false,
					  duration: 1000
					});
				}
				
			} else {
				uni.showToast({
					icon: 'none',
					title: res.data.msg+'关注提示'
				});
			}
		})
	},
    //获取评论
    fetchCommentData: function () {
      
    },
	// 登录校验
	checkLogin() {
		// TODO 此处填写登录校验逻辑
		var userInfo = uni.getStorageSync('userInfo');
		if (userInfo) {
			return true;
		} else {
			uni.showModal({
				title: '提示',
				content: '请先登录',
				confirmText: '前往登录',
				success: function(res) {
					if (res.confirm) {
						uni.navigateTo({
							url: '/pages/login/login'
						});
					}
				}
			});
			return false;
		}
	},
	// 输入框聚焦
	focusOn() {
		this.checkLogin();
	},
	shiminghuifu(){
		
		var duixin = this;
		var getShiminghuifuRequest = wxRequest.getRequest(Api.getShiminghuifu(duixin.memberuid,duixin.userInfo));
		var res;
		getShiminghuifuRequest.then(response => {
			res = response;
			if(res.data.code) {
                
			} else {
				if(res.data.msg=="账号必须实名认证"){
					duixin.shipinhuifudata = false;
				} else {
					
				}
			}
		})
	},
	// 新增评论
	add(req,uid,code) {
		
		if (!this.checkLogin()) {
			return
		}
		var that = this;
		//that.fetchDetailData(options.id);
		var skin = uni.getStorageSync('skin');
		var tieids = that.tieids;
		//console.log("帖子ids",tieids);
		//判断用户是否登录
		var userInfo = uni.getStorageSync('userInfo');
		//console.log("options",options);
		if (userInfo) {
			var member = uni.getStorageSync('member');
			var memberuid = uni.getStorageSync('memberuid');
			
		}
		if (that.reqFlag) {
			uni.showToast({
				title: '操作频繁',
				duration: 500
			});
			return
		}
		
		that.reqFlag = true;
		let params = {
			"articleId": that.articleId,
			"pId": req.pId,
			"content": req.content
		}
		
		var datas = "is_ajax=1&content="+that.pingluncontents;
		console.log("req.rid",req);
		var postPinglunRequest = wxRequest.postRequest(Api.postPinglun(req.pId,memberuid,userInfo,req.rid),datas);
		postPinglunRequest.then(response => {
			//res = response;
			if (response.data.code == 1) {
			  //console.log('二级评论',req.erjiuid); 
			  uni.showToast({
			  	title: "评论成功",
			  	duration: 1000
			  });
			  that.reqFlag = false;
			  that.$refs.hbComment.addComplete();
			  that.getPinglunNeirong(tieids,memberuid,userInfo);
			  uni.showToast({
			  	title: "更新加载",
			  	duration: 2000
			  });
			  if(req.rid >0){
				  var pinglun_data = '{"type":"pinglun","tieid":"'+tieids+'","uid":"'+that.uid+'","tieuid":"'+that.tieziindex.uid+'","tiename":"2","tozanuid":"'+req.erjiuid+'","tozanname":"'+that.member.name+'","avatar":"'+that.member.avatar+'"}';
				  if(req.erjiuid != that.uid) {
				  	
					/*#ifdef H5*/
					that.duixinim.send(pinglun_data);
					/*#endif*/
					/*#ifdef MP-WEIXIN || APP-PLUS*/
					uni.sendSocketMessage({
					      data: pinglun_data
					});
					/*#endif*/
				  }
			  } else {
				  var pinglun_data = '{"type":"pinglun","tieid":"'+tieids+'","uid":"'+that.uid+'","tieuid":"'+that.tieziindex.uid+'","tiename":"2","tozanuid":"'+that.uid+'","tozanname":"'+that.member.name+'","avatar":"'+that.member.avatar+'"}';
				  if(that.tieziindex.uid != that.uid) {
				  	
					/*#ifdef H5*/
					that.duixinim.send(pinglun_data);
					/*#endif*/
					/*#ifdef MP-WEIXIN || APP-PLUS*/
					uni.sendSocketMessage({
					      data: pinglun_data
					});
					/*#endif*/
				  }
			  }
			  
			} else {
				if(response.data.msg=="账号必须实名认证"){
					uni.showModal({
						title: response.data.msg,
						//content: '请先登录',
						confirmText: '前往认证',
						success: function(res) {
							if (res.confirm) {
								uni.navigateTo({
									url: '/pages/shezhi/renzheng'
								});
							}
						}
					});
				} else {
					  uni.showToast({
						title: response.data.msg,
						duration: 1000
					  });
				}
			}
		});
		// TODO 接入真实接口
		// let params = {
		// 	"articleId": this.articleId,
		// 	"pId": req.pId,
		// 	"content": req.content
		// }
		// this.$u.api.commentAdd(params).then(res => {
		// 	uni.showToast({
		// 		title: '操作成功！',
		// 		duration: 3000
		// 	});
		// 	this.$refs.hbComment.addComplete();
		// 	this.getComment();
		// 	this.reqFlag = false;
		// }).catch(res => {
		// 	this.reqFlag = false;
		// })
		// 下边假装请求成功
		//this.reqFlag = false;
		//this.$refs.hbComment.addComplete();
		//this.getComment();
	},
	//点赞
	getZan(tieziid,uid){
		console.log('getZan',uid); 
		var that = this;
		/*self.setData({
		    pinglun: []
		});*/
		var getZanRequest = wxRequest.getRequest(Api.getZan(tieziid,that.memberuid,that.userInfo));
		var res;
		getZanRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.msg.status == 1) {
					uni.showToast({
						title: res.data.msg.value+' '+res.data.msg.jifen,
						icon: 'success',
						duration: 2000
					});
					that.dianzan = "thumb-up-fill";
					that.getZanzhi(tieziid);
					var zan_data = '{"type":"zan","tieid":"'+tieziid+'","uid":"'+that.uid+'","tieuid":"'+uid+'","tiename":"2","tozanuid":"'+that.uid+'","tozanname":"'+that.member.name+'","avatar":"'+that.member.avatar+'"}';
					
					if(uid != that.uid) {
						
						/*#ifdef H5*/
						that.duixinim.send(zan_data);
						/*#endif*/
						/*#ifdef MP-WEIXIN  || APP-PLUS*/
						uni.sendSocketMessage({
						      data: zan_data
						});
						/*#endif*/
					}
					that.getDianzantongjideta();
				} else {
					uni.showToast({
						title: res.data.msg.value+' '+res.data.msg.jifen,
						icon: 'success',
						duration: 2000
					});
					that.dianzan = "thumb-up";
					that.getZanzhi(tieziid);
					that.getDianzantongjideta();
					
				}
				
			} else {
				if(res.data.msg=="账号必须实名认证"){
					uni.showModal({
						title: res.data.msg,
						//content: '请先登录',
						confirmText: '前往认证',
						success: function(res) {
							if (res.confirm) {
								uni.navigateTo({
									url: '/pages/shezhi/renzheng'
								});
							}
						}
					});
				} else {
				
					that.dianzan = "thumb-up";
					uni.showModal({
					title: '请先登录',
					//content: '请先登录',
					confirmText: '前往登录',
					success: function(res) {
						if (res.confirm) {
							uni.redirectTo({
								url: '/pages/login/login'
							});
						}
					}
					});
			    }
			}
		})
		
	},
	//判断是否点赞
	getZanzhi(tieziid){
		var that = this;
		var getZanRequest = wxRequest.getRequest(Api.getZan(tieziid,that.memberuid,that.userInfo)+'&zan=1');
		var res;
		getZanRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.msg.zanzhi == 1){
					that.dianzan = "thumb-up-fill";
				} else {
					that.dianzan = "thumb-up";
				}
			} else {
			  /*uni.showToast({
			  	icon: 'none',
			  	title: '获取失败，请稍后重试'
			  });*/
			  that.dianzan = "thumb-up";
			}
		})
		
	},
	//收藏heart
	getShoucang(tieziid){
		var that = this;
		/*self.setData({
		    pinglun: []
		});*/
		var getShoucangRequest = wxRequest.getRequest(Api.getShoucang(tieziid,that.memberuid,that.userInfo));
		var res;
		getShoucangRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.msg.status == 1) {
					uni.showToast({
						title: res.data.msg.value+' '+res.data.msg.jifen,
						icon: 'success',
						duration: 2000
					});
					that.shoucang = "heart-fill";
					that.getShoucangzhi(tieziid);
				} else {
					uni.showToast({
						title: res.data.msg.value+' '+res.data.msg.jifen,
						icon: 'success',
						duration: 2000
					});
					that.shoucang = "heart";
					that.getShoucangzhi(tieziid);
					
				}
				
			} else {
			  /*uni.showToast({
			  	icon: 'none',
			  	title: '还没有登录'
			  });*/
			  that.shoucang = "heart";
			  uni.showModal({
			  	title: '请先登录',
			  	//content: '请先登录',
			  	confirmText: '前往登录',
			  	success: function(res) {
			  		if (res.confirm) {
			  			uni.redirectTo({
			  				url: '/pages/login/login'
			  			});
			  		}
			  	}
			  });
			  //uni.reLaunch({ url: '/pages/login/login'}) // 跳转到登录页
			}
		})
		
	},
	//判断收藏值
	getShoucangzhi(tieziid){
		var that = this;
		var getShoucangzhiRequest = wxRequest.getRequest(Api.getShoucang(tieziid,that.memberuid,that.userInfo)+'&shoucang=1');
		var res;
		getShoucangzhiRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.msg.shoucangzhi == 1){
					that.shoucang = "heart-fill";
				} else {
					that.shoucang = "heart";
				}
			} else {
			  /*uni.showToast({
			  	icon: 'none',
			  	title: '获取失败，请稍后重试'
			  });*/
			  that.shoucang = "heart";
			}
		})
		
	},
	//用户认证
	getRenzheng(uid){
		var duixin = this;
		var getRenzhengszhiRequest = wxRequest.getRequest(Api.getRenzhengs(uid));
	    var res;
		getRenzhengszhiRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.code == 1){
					duixin.rzs = res.data.data.rzs[0];
					//console.log('认证：',duixin.rzs);
				} else {
					
				}
			} else {
			  /*uni.showToast({
			  	icon: 'none',
			  	title: '获取失败，请稍后重试'
			  });*/
			  that.shoucang = "heart";
			}
		})
	},
	// 评论内容
	pingluncontent(e){
		var duixin = this;
		duixin.pingluncontents = e;
		//console.log('pinglun',e)
	},
	//拉黑评论
	laheidata(data,id){
		var duixin = this;
		if(data.zhi==2){
			//屏蔽评论
			console.log('datapp222',data);
			console.log('idpp222',id);
			duixin.postPingbiPinglunData(data.value);
		}
		if(data.zhi==1){
			//拉黑用户
			duixin.postLaheiyonghuData(data.value);
			//console.log('datapp111',data);
			//console.log('idpp111',id);
		}
	},
	//获取当前页面
	getDangqianurl() {
		//获取当前页面栈的实例
		let pages = getCurrentPages();
		//获取当前页面
		let currentPage = pages[pages.length-1].$page.fullPath;
		let url = currentPage;
		uni.setStorageSync('dangqianUrl', url);
	},
	// 个人页面
	getgeren(uid) {
		
		var url = '../u/index?&uid='+uid;
		uni.navigateTo({
			url: url
		});
	},
	//阅读图片
	showimgs(e){
		var duixin = this;
		var urls = duixin.tiezineirong.jiugetu;
		var urlsimg = [];
		for (let i = 0; i < urls.length; i++) {
			urlsimg[i] = urls[i].url
		}
		uni.previewImage({
		  urls: urlsimg,
		  current: e
		});
	},
	//进度条
	getJindus(id) {
		var duixin = this;
		var getJinduRequest = wxRequest.getRequest(Api.getJindu(id));
		var res;
		getJinduRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.code == 1){
					duixin.jindu = res.data.data;
				} else {
					
				}
			} else {

			  that.shoucang = "heart";
			}
		})
	},
	// 下载
	xiazaifujian(){
		
	},
	//附件url
	fujianurl(url){
		console.log("附件url",url);
		uni.showLoading({title: '正在下载……'});
		/*#ifdef H5*/
		window.location.href = url;
        uni.hideLoading();
		uni.showToast({
			icon: 'none',
			mask: true,
			title: '文件已保存', 
			duration: 3000,
		});
		/*#endif*/
		/*#ifdef MP-WEIXIN || APP-PLUS*/
		uni.showLoading({title: '正在下载……'});
		uni.downloadFile({
				url: url,//下载地址接口返回
				success: (res) => {
					//console.log('打印data',res)
					uni.hideLoading();
					//文件保存到本地
					if (res.statusCode === 200) {
						//保存文件
						let tempFile = res.tempFilePath;
						
						/*#ifdef APP-PLUS */
						//保存到本地
						uni.saveFile({
							tempFilePath: res.tempFilePath,//文件的临时路径
							success: function(res) {
								const savedFilePath = res.savedFilePath;
								// 打开文件
								uni.openDocument({
									filePath: savedFilePath,
									success: function(res) {
										uni.hideLoading()
									},
									fail: function(res) {},
									complete: function(res) {
										setTimeout(uni.hideLoading(), 4000)
									},
								});
							},
							fail: function(err) {	}
						});
						/*#endif*/
						/*#ifdef MP-WEIXIN*/
						//保存成功之后 打开文件
						uni.getFileSystemManager().saveFile({
						tempFilePath: tempFile,
						// filePath: wx.env.USER_DATA_PATH + '/' + '上传成员.pdf',//自定义文件名
						success(res) {
							uni.showToast({
								icon: 'none',
								mask: true,
								title: '文件已保存', 
								duration: 3000,
							});
							/*console.log(res)
								uni.openDocument({
									filePath: res.savedFilePath,
									showMenu: true, //是否可以分享
									success: (res) => {
										uni.hideLoading()
										console.log(res);
									},
									fail: (e) => {
										uni.showToast({
											title: '打开失败',
											icon: "error"
										})
									}
								})*/

							}
						})
						/*#endif*/
					}
				},
				fail: (e) => {
					console.log(e, '文件下载失败')
					uni.showToast({
						title: '文件下载失败',
						icon: "error",
					})
				}

			
			});
		/*#endif*/

	},
	yunurl(url,ma) {
		//console.log("附件url",url);
		uni.setClipboardData({
		  data: url+' 认证码:'+ma,
		  success: () => {
		    uni.showToast({
		      title: '复制成功'
		    });
		  },
		  fail: () => {
		    uni.showToast({
		      title: '复制失败.未开通权限',
		      icon: 'none'
		    });
		  }
		});
	},
	jubao(id) {
		console.log("id",id);
	},
	jubaoclose(){
		this.jubaoshow = false
	},
	jubaoopen(){
		var duixin = this;
		duixin.jubaoshow = true
		//console.log("id");
	},
	postJubao(id){
		console.log("postJubao",id);
	},
	checkboxChange(n) {
		this.jubaoxuanzedata = n;
	},
	//重新链接
	getimin(uid,member){
		var duixin = this;
		
		if (!duixin.duixinimin || duixin.duixinimin.readyState == 3) { 
			/*#ifdef H5*/
			duixin.duixinimin = new WebSocket(wss);  
			  
			duixin.duixinimin.onopen = () => {  
			  console.log('im连接成功',duixin.duixinim);  
			  duixin.message = '已连接';
			  var login_data = '{"type":"login","name":"'+member.name+'","uid":"'+uid+'"}';
			  //console.log("登录成功，发送登录数据:"+login_data);
			  duixin.duixinim.send(login_data);
			};  
			  
			duixin.duixinimin.onmessage = duixin.getOnmessage;  
			  
			duixin.duixinimin.onclose = function(event) {
			  console.log('im已关闭，尝试重新连接...', event);
			  duixin.message = '连接已断开';  
			  setTimeout(() => {  
				duixin.getimin(); // 延迟重新连接，避免频繁尝试连接
				console.log('im连接成功in'); 
			  }); // 5秒后重新连接  , 5000
			};  
			duixin.duixinimin.onerror = function(error) {  
			  console.error('im错误:', error);  
			}; 
			/*#endif*/
			/*#ifdef MP-WEIXIN  || APP-PLUS*/
			uni.connectSocket({
			  url: wss,
			  success(data) {
			     console.log("websocket连接成功",data);
			  },
			  fail(err) {
				console.error('WebSocket连接失败', err);
			  }
			});
			uni.onSocketOpen(function (res) {
			  console.log('WebSocket连接已打开！');
			  var login_data = '{"type":"login","name":"'+member.name+'","uid":"'+uid+'"}';
			    uni.sendSocketMessage({
			        data: login_data
			    });
			});
			uni.onSocketMessage(function (res) {
			  console.log('收到服务器内容：' + res.data);
			  duixin.getOnmessage(res);
			});
			uni.onSocketClose(function (res) {
			  console.log('WebSocket 已关闭！');
			  setTimeout(() => {
				duixin.getimin(); // 延迟重新连接，避免频繁尝试连接
				console.log('im连接成功in'); 
			  }); // 5秒后重新连接  , 5000
			});
			uni.onSocketError(function (res) {
			  console.log('WebSocket连接打开失败，请检查！');
			});
			/*#endif*/
		} else {  
		console.log('im连接已存在');  
		} 
	},
	getOnmessage(e){
		var duixin = this;
		//console.log('收信息',e.data);
		var shouxin = JSON.parse(e.data); 
		duixin.shouxin = shouxin;
		if(shouxin.type == 'zan') {
			if(duixin.uid==shouxin.tieuid){
				duixin.toptishishow = true;
				duixin.dianzanname = shouxin.tozanname;
				duixin.dianzantouxiang = shouxin.avatar;
				duixin.duanxintongzhi = 1;
				duixin.getTongjis(duixin.uid);
				setTimeout(() => {  
					duixin.toptishishow = false; // 五秒后隐藏
				}, 3000); // 延迟时间为 5000 毫秒（即 5 秒）
			}
			
		}
	},
	//获取消息统计
	getTongjis(uid) {
	  	var self = this;
	  	//console.log('xx'); 
	  	var getXiaoxitongjiRequest = wxRequest.getRequest(Api.getXiaoxitongji(uid));
	  	getXiaoxitongjiRequest.then(response => {
	  		if (response.data.code == 1) {
	  		  //console.log(response.data.data); 
	  		  self.tongji = response.data.data
			  self.tongzhis(response.data.data);
	  		} else {
	  		  self.setData({
	  			displaySwiper: "none"
	  		  });
	  		}
	  	});
	},
	// 通知
	tongzhis(e){
		var tongjishu = e;
		
	},
	//举报
	postJubaodata(id){
		var duixin = this;
		let pages = getCurrentPages();  
		let currentPage = pages[pages.length - 1];  
		let url = currentPage.route; // 当前页面的路由地址

		var wangzhi = url+'?qid='+duixin.qid+'&id='+duixin.tieids;
		var shuoming = duixin.jubaoData.neirong;
		if(!shuoming) {
			uni.showToast({
				title: '填写举报内容',
				icon: "error",
			})
		}
		var n = duixin.jubaoxuanzedata;
		if(!n.length) {
			uni.showToast({
				title: '选择标签',
				icon: "error",
			})
		}
		var jubaoshuju=[];
		for (var i = 0; i < n.length; i++) {
            jubaoshuju[i]={};
		  if (n[i] == '广告') {
			  this.jubaoshuju.wenti1 = 1; 
			  jubaoshuju[i].cid = this.jubaoshuju.wenti1;
			  
		  }
		  if (n[i] == '重复') {
		  		this.jubaoshuju.wenti2 = 2; 
				jubaoshuju[i].cid = this.jubaoshuju.wenti2;
		  		
		  }
		  if (n[i] == '低俗') {
		  		this.jubaoshuju.wenti3 = 3; 
				jubaoshuju[i].cid = this.jubaoshuju.wenti3;
		  		
		  }
		  if (n[i] == '夸张') {
		  		this.jubaoshuju.wenti4 = 4; 
				jubaoshuju[i].cid = this.jubaoshuju.wenti4;
		  		
		  }
		}
		let wenti = '';
		jubaoshuju.forEach(item=>{
			wenti+= '&data[wenti][]='+item.cid;
		})
		var datas = "is_ajax=1&catid=1&data[wangzhi]="+wangzhi+"&data[shuoming]="+shuoming+wenti;
		console.log('datas',datas); 
		var postJubaoRequest = wxRequest.postRequest(Api.postJubao(duixin.uid,duixin.userInfo,duixin.tieids),datas);
	    postJubaoRequest.then(response => {
			if (response.data.code == 1) {
				uni.showToast({
					title: response.data.msg,
					icon: 'success',
					duration: 5000
				});
				}
				duixin.jubaoshow = false;
				duixin.jubaoData.neirong = '';
				duixin.jubaoxuanzedata = [];
			});
	},
	//点赞统计
	getDianzantongjideta(){
		
		var duixin = this;
		var getDianzantongjiRequest = wxRequest.getRequest(Api.getDianzantongji(duixin.tieids));
		var res;
		getDianzantongjiRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.code == 1){
					duixin.dianzandata = res.data.data;
					if(res.data.data[0]){
						duixin.dianzanshu = res.data.data[0].dianzanshu;
					} else {
						var tongji = duixin.dianzanshu-1;
						if(tongji == -1){
							duixin.dianzanshu = 0;
						} else {
							duixin.dianzanshu = tongji;
						}
					}
					
				} else {
				}
			} else {
			  /*uni.showToast({
			  	icon: 'none',
			  	title: '获取失败，请稍后重试'
			  });*/
			}
		})
	},
	//圈子
	getQuan(id){
		var url = '../quan/quanzi?id=' + id;
		uni.navigateTo({
				url: url
		});
	},
	//审核帖子
	shenhe(e) {
		console.log('shenhe', e);
		if(e ==1){
			this.shenheshow = true;
		}
	},
	//审核关闭
	shenheguanbi(){
		this.shenheshow = false;
	},
	//审核确认
	shenhequerren(){
		this.getShenhequeren();
	},
	//删除
	shanchu(){
		this.getShanchu();
	},
	//审核确认接口
	getShenhequeren(){
		var duixin = this;
		var getShenhetieziRequest = wxRequest.getRequest(Api.getShenhetiezi(duixin.memberuid,duixin.keycode,duixin.tieids));
		var res;
		getShenhetieziRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.msg.status == 1){
					uni.showToast({
						title: res.data.msg.value,
						icon: 'success',
						duration: 2000
					});
					if(res.data.msg.value=="设置审核成功"){
						
						duixin.jindu['shenhe'] = 1;
						this.shenheshow = false;
						duixin.unshenhe =1;
					} else {
						duixin.jindu['shenhe'] = 0;
					}
					
					
				} else {
					
				}
			} else {
			  /*uni.showToast({
			  	icon: 'none',
			  	title: '获取失败，请稍后重试'
			  });*/
			  
			}
		})
	},
	//删除帖子接口
	getShanchu(){
		var duixin = this;
		var getShanchutieziRequest = wxRequest.getRequest(Api.getShanchutiezi(duixin.memberuid,duixin.keycode,duixin.tieids));
		var res;
		getShanchutieziRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.msg.status == 1){
					uni.showToast({
						title: res.data.msg.value,
						icon: 'success',
						duration: 2000
					});
					//返回上一页
					uni.navigateBack({
						delta: 1
					});
				} else {
					uni.showToast({
						title: res.data.msg.value,
						icon: 'success',
						duration: 2000
					});
				}
			} else {
			  /*uni.showToast({
			  	icon: 'none',
			  	title: '获取失败，请稍后重试'
			  });*/
			  
			}
		})
	},
	//点赞评论
	like(){
		
	},
	//删除评论
	del(){
		
	},
	//问答进度条
	getWendadata(id) {
		var duixin = this;
		var getWendaRequest = wxRequest.getRequest(Api.getWenda(id));
		var res;
		getWendaRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.code == 1){
					duixin.wenda = res.data.data;
					duixin.wendakaiguan = res.data.data['wendakaiguan'];
					//console.log(res.data.data['wendakaiguan'])
				} else {
					
				}
			} else {
	
			}
		})
	},
	//问答答案列表
	getWendadlist(id,data){
		var duixin = this;
		if (!data) data = {};
		if (!data.page) data.page = 1;
		if (!data.categories) data.categories = 0;
		if (!data.search) data.search = '';
		
		if (data.page === 1) {
			duixin.setData({
			  postsList: []
			});
		}
		
		;
		duixin.setData({
			//isLoading: true
		});
			  
		var getWendalistRequest = wxRequest.getRequest(Api.getWendalist(id,data));
		getWendalistRequest.then(response => {
			//console.log("列表",response.data.data);
		if (response.data.code == 1) {
			
			if (response.data.data.length) {
			  if (response.data.data.length < pageCount) {
				duixin.setData({
				  isLastPage: true,
				  isLoading: false,
				});
			  }
			  //console.log('当前页下',duixin.xialajiazai);
			  duixin.setData({
				floatDisplay: "block",
				postsList: duixin.postsList.concat(response.data.data.map(function (item) {
			
				  if (item.thumb == null || item.thumb == '') {
					item.thumb = "/static/images/logo700.png";
				  }

				  return item;
				}))
			  });
			  
			} else {
			  if (response.data.code == "rest_post_invalid_page_number") {
				duixin.setData({
				  isLastPage: true,
				  isLoading: false
				});

				/*uni.showToast({
				  title: '没有更多内容',
				  mask: false,
				  duration: 1500
				});*/
				
			  } else {
				// 隐藏提示
				/*uni.showToast({
				  title: response.data.message,
				  duration: 1500
				});*/
				/*uni.showToast({
				  title: '没有更多内容',
				  duration: 500
				});*/
				/*duixin.daodi = true;*/
				//console.log('没有了',duixin.daodi);
			  }
			}
		  }
		}).catch(function (response) {
		  if (data.page == 1) {
			duixin.setData({
			  showerror: "block",
			  floatDisplay: "none"
			});
		  } else {
			/*uni.showModal({
			  title: '加载失败',
			  content: '加载数据失败,请重试.',
			  showCancel: false
			});*/
			/*duixin.setData({
			  page: data.page - 1
			});*/
		  }
		}).finally(function (response) {
		  uni.hideLoading();
		  /*duixin.setData({
			isLoading: false
		  });*/
		  uni.stopPullDownRefresh();
		});
	},
	//问答按钮
	wendatijiaochange(e){
		
	},
	//提交答案
	wendatijiaodata(tid,qid){
		var url = '/pages/quan/daanfabu?tid='+tid+'&cid='+qid;
		console.log("url",url);
		uni.navigateTo({
			url: url
		});
	},
	//跳转答案帖子
	daantiezi(tieid){
		console.log("id",tieid);
		var url = '/pages/tiezi/daantiezi?&id='+tieid;
		console.log("url",url);
		uni.navigateTo({
			url: url
		});
	},
	//招聘进度条
	getZhaopindata(id) {

		var duixin = this;
		var getZhaopinRequest = wxRequest.getRequest(Api.getZhaopin(id));
		var res;
		getZhaopinRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.code == 1){
					duixin.zhaopin = res.data.data;
					//duixin.wendakaiguan = res.data.data['wendakaiguan'];
					//console.log(res.data.data['wendakaiguan'])
				} else {
					
				}
			} else {
	
			}
		})
	},
	//已经招聘到
	zhaodao(){
		var duixin = this;
		if(duixin.uid == duixin.tieziindex.uid || duixin.member && duixin.member.is_admin ==1){
			if(duixin.zhaopin.zhaopinbiao==1){
				var zhaodao ="是否重新开启招聘";
			} else {
				var zhaodao ="是否确认已经招到";
			}
			uni.showModal({
				title: zhaodao,
				//content: '请先登录',
				confirmText: '确认',
				success: function(res) {
					if (res.confirm) {
						duixin.zhaodaodata();
					}
				}
			});
		} else {
			uni.showToast({
			  title: '您不是发帖者无权操作',
			  duration: 500
			});
		}
		
	},
	//招聘招到
	zhaodaodata(){
		//uid,code,id,quanid getZhaopinqueren(uid,code,id,quanid)
		
		var duixin = this;
		var getZhaopinquerenRequest = wxRequest.getRequest(Api.getZhaopinqueren(duixin.uid,duixin.keycode,duixin.tieids,duixin.qid));
		var res;
		getZhaopinquerenRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.code == 1){
					
					if(res.data.msg.value=="已聘到啦"){
						duixin.getZhaopindata(duixin.tieids);
					} else {
						duixin.getZhaopindata(duixin.tieids);
					}
					
				} else {
					
				}
			} else {
			
			}
		})
	},
	//问答奖励
	getWendajianglidata(leixing,tieid,tieuid){
		var duixin = this;
		if(leixing==1){
			var zhuangtai = "确认选择鼓励1积分";
		} else if(leixing==2){
			var zhuangtai = "确认选择鼓励0.1";
		} else if(leixing==3){
			var zhuangtai = "确认选择感谢参与";
		} else if(leixing==4){
			var zhuangtai = "确认选择中标";
		}
		uni.showModal({
			title: zhuangtai,
			//content: '请先登录',
			confirmText: '确认',
			success: function(res) {
				if (res.confirm) {
					//console.log("请先登录",4)
					duixin.getWendajiangligaibian(leixing,tieid,tieuid);
				}
			}
		});
	},
	getWendajiangligaibian(leixing,tieid,tieuid){
		var duixin = this;
		var getWendajiangliRequest = wxRequest.getRequest(Api.getWendajiangli(duixin.uid,duixin.keycode,tieid,leixing,tieuid));
		var res;
		getWendajiangliRequest.then(response => {
			res = response;
			if(res.data.code) {
				    console.log('4',res.data.msg.status);
					if(res.data.msg.status==4){
						duixin.getdaanqueren(4,tieid); 
					} else if(res.data.msg.status==1) {
						duixin.getdaanqueren(1,tieid);
					} else if(res.data.msg.status==2) {
						duixin.getdaanqueren(2,tieid);
					} else if(res.data.msg.status==3) {
						duixin.getdaanqueren(3,tieid);
					}
			} else {
			}
		})
	},
	//答案确认
	getdaanqueren(id,tieid){
		var duixin = this;
		if(id==1){
			var zhuangtai = "鼓励积分";
		} else if(id==2){
			var zhuangtai = "鼓励0.1";
		} else if(id==3){
			var zhuangtai = "感谢参与";
		} else if(id==4){
			var zhuangtai = "中标成功";
		}
		duixin.getWendadlist(tieid,duixin);
		uni.showToast({
		  title: zhuangtai,
		  duration: 1000
		});
	},
	getdaan(){
		console.log(e)
		/*var url = '../u/index?&uid='+uid;
		uni.navigateTo({
			url: url
		});*/
	},
	//设置
	shezhi(){
		
	},
	//设置展示
	shezhishows(){
		
	},
	//设置关闭
	shezhiclose(){
		this.shezhishow = false
	},
	 //设置开关
	shezhiopen(){
		  
	},
	//判断是否开启BUG帖子
	bug(){
		var duixin = this;
		var getBugRequest = wxRequest.getRequest(Api.getBug(duixin.uid,duixin.keycode,duixin.tieids,duixin.qid));
		var res;
		getBugRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.code == 1){
					uni.showToast({
						title: res.data.msg.value,
						icon: 'success',
						duration: 2000
					});
					if(res.data.msg.value=="开启修复"){
						duixin.jindu['bugkaiguan'] = 1;
					} else {
						duixin.jindu['bugkaiguan'] = 0;
					}
					
				} else {
					
				}
			} else {
			
			}
		})
	},
	//开启需求
	xuqiu(){
		var duixin = this;
		var getXuqiuRequest = wxRequest.getRequest(Api.getXuqiu(duixin.uid,duixin.keycode,duixin.tieids,duixin.qid));
		var res;
		getXuqiuRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.code == 1){
					uni.showToast({
						title: res.data.msg.value,
						icon: 'success',
						duration: 2000
					});
					if(res.data.msg.value=="开启需求"){
						duixin.jindu['xuqiukaiguan'] = 1;
					} else {
						duixin.jindu['xuqiukaiguan'] = 0;
					}
					
				} else {
					
				}
			} else {
			
			}
		})
	},
	//圈子置顶
	quanzhidingdata(){
		var duixin = this;
		var getQuanzhidingRequest = wxRequest.getRequest(Api.getQuanzhiding(duixin.uid,duixin.keycode,duixin.tieids,duixin.qid));
		var res;
		getQuanzhidingRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.code == 1){
					uni.showToast({
						title: res.data.msg.value,
						icon: 'success',
						duration: 2000
					});
					if(res.data.msg.value=="设置置顶成功"){
						duixin.jindu['zhiding'] = 1;
					} else {
						duixin.jindu['zhiding'] = 0;
					}
					
				} else {
					
				}
			} else {
			
			}
		})
	},
	//首页置顶
	quanshouyedata(){
		var duixin = this;
		var getShouyezhidingRequest = wxRequest.getRequest(Api.getShouyezhiding(duixin.uid,duixin.keycode,duixin.tieids,duixin.qid));
		var res;
		getShouyezhidingRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.code == 1){
					uni.showToast({
						title: res.data.msg.value,
						icon: 'success',
						duration: 2000
					});
					if(res.data.msg.value=="设置置顶成功"){
						duixin.jindu['tuijian'] = 1;
					} else {
						duixin.jindu['tuijian'] = 0;
					}
					
				} else {
					
				}
			} else {
			
			}
		})
	},
	//帖子精华
	quanjinghuadata(){
		var duixin = this;
		var getTiejinghuaRequest = wxRequest.getRequest(Api.getTiejinghua(duixin.uid,duixin.keycode,duixin.tieids,duixin.qid));
		var res;
		getTiejinghuaRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.code == 1){
					uni.showToast({
						title: res.data.msg.value,
						icon: 'success',
						duration: 2000
					});
					if(res.data.msg.value=="设置精华成功"){
						duixin.jindu['jinghua'] = 1;
					} else {
						duixin.jindu['jinghua'] = 0;
					}
					
				} else {
					
				}
			} else {
			
			}
		})
	}, //quanzhanzhidingdata
	//全站置顶
	quanzhanzhidingdata(){
		var duixin = this;
		var getQuanzhanzhidingRequest = wxRequest.getRequest(Api.getQuanzhanzhiding(duixin.uid,duixin.keycode,duixin.tieids,duixin.qid));
		var res;
		getQuanzhanzhidingRequest.then(response => {
			res = response;
			if(res.data.code) {
				if(res.data.code == 1){
					uni.showToast({
						title: res.data.msg.value,
						icon: 'success',
						duration: 2000
					});
					if(res.data.msg.value=="设置全置成功"){
						duixin.jindu['qzzd'] = 1;
					} else {
						duixin.jindu['qzzd'] = 0;
					}
					
				} else {
					
				}
			} else {
			
			}
		})
	},
	bianjidata(){
		uni.showToast({
			title: "开发中。。。",
			icon: 'success',
			duration: 2000
		});
	},
	//改变需求进度
	jinduleixing(leixing){
		var duixin = this;
		if(duixin.member['is_admin'] ==1) {
			//console.log('dddd',leixing)
			var getJindudataRequest = wxRequest.getRequest(Api.getJindudata(duixin.uid,duixin.keycode,duixin.tieids,duixin.qid,leixing));
			var res;
			getJindudataRequest.then(response => {
				res = response;
				if(res.data.code) {
					if(res.data.code == 1){
						uni.showToast({
							title: res.data.msg.value,
							icon: 'success',
							duration: 2000
						});
						if(res.data.msg.leixing == 1){
							
						} else if(res.data.msg.leixing == 2) {
							duixin.jindu['xuqiu'] = 1;
							duixin.getJindus(duixin.tieids);
						} else if(res.data.msg.leixing == 3) {
							duixin.jindu['xuqiu'] = 2;
							duixin.getJindus(duixin.tieids);
						} else if(res.data.msg.leixing == 4) {
							duixin.jindu['xuqiu'] = 3;
							duixin.getJindus(duixin.tieids);
						}
						
					} else {
						
					}
				} else {
				
				}
			})
		}
		//
	},
	//改变bug需求进度
	bugleixing(leixing){
		var duixin = this;
		if(duixin.member['is_admin'] ==1) {
			//console.log('dddd',leixing)
			var getBugdataRequest = wxRequest.getRequest(Api.getBugdata(duixin.uid,duixin.keycode,duixin.tieids,duixin.qid,leixing));
			var res;
			getBugdataRequest.then(response => {
				res = response;
				if(res.data.code) {
					if(res.data.code == 1){
						uni.showToast({
							title: res.data.msg.value,
							icon: 'success',
							duration: 2000
						});
						if(res.data.msg.leixing == 1){
							
						} else if(res.data.msg.leixing == 2) {
							duixin.jindu['bugs'] = 1;
							duixin.getJindus(duixin.tieids);
						} else if(res.data.msg.leixing == 3) {
							duixin.jindu['bugs'] = 2;
							duixin.getJindus(duixin.tieids);
						} else if(res.data.msg.leixing == 4) {
							duixin.jindu['bugs'] = 3;
							duixin.getJindus(duixin.tieids);
						}
						
					} else {
						
					}
				} else {
				
				}
			})
		}
		//
	},
	kefu(){
		uni.navigateTo({
		  url: '/pages/kefu/kefu',
		});
	},
	//微信客服接口
	getWeixinkefuData(){
		var duixin = this;
		//console.log('xx'); 
		var getWeixinkefuRequest = wxRequest.getRequest(Api.getWeixinkefu());
		getWeixinkefuRequest.then(response => {
			if (response.data.code == 1) {
			  //console.log(response.data.data); 
			  duixin.weixinkefu = response.data.data
			} else {
			  duixin.setData({
				displaySwiper: "none"
			  });
			}
		});
	},
	//视频内容
	getShipinData(){
		var duixin = this;
		//console.log('xx'); 
		var getShipinRequest = wxRequest.getRequest(Api.getShipin(duixin.tieids));
		getShipinRequest.then(response => {
			if (response.data.code == 1) {
			  //console.log('shipin',response.data.data); 
			  duixin.shipindata = response.data.data[0]
			} else {
			  duixin.setData({
				displaySwiper: "none"
			  });
			}
		});
	},
	getWww() {
		var duixin = this;
		
		var uid = duixin.userInfo;
		var getTubiaoRequest = wxRequest.getRequest(Api.getWwwUrl(uid,duixin.uid,duixin.userInfo));
		getTubiaoRequest.then(response => {
			if (response.data.code == 1) {
			  //console.log(response.data.data); 
			  duixin.www = response.data.data
			  duixin.getWeixinFengxiangTus();
			} else {
			  duixin.setData({
				displaySwiper: "none"
			  });
			}
		});
	},
	// 圈子属性
	getQuanzishuxingData(){
		var duixin = this;
		//console.log('xx'); 
		var getQuanzishuxingRequest = wxRequest.getRequest(Api.getQuanzishuxing());
		getQuanzishuxingRequest.then(response => {
			if (response.data.code == 1) {
			  //console.log(response.data.data); 
			  duixin.quanzishuxing = response.data.data
			} else {
			  duixin.setData({
				displaySwiper: "none"
			  });
			}
		});
	},
	//MP3内容
	getMpsanData(){
		var duixin = this;
		//console.log('xx'); 
		var getMpsanRequest = wxRequest.getRequest(Api.getMpsan(duixin.tieids));
		getMpsanRequest.then(response => {
			if (response.data.code == 1) {
			  //console.log('shipin',response.data.data); 
			  duixin.mpsandata = response.data.data[0] && response.data.data[0].mpsan
			} else {
			  duixin.setData({
				displaySwiper: "none"
			  });
			}
		});
	},
	//设置关闭
	mpsanclose(){
		this.mpsanshow = false
	},
	mpsanopen(){
		
	},
	mpsanbofang(title,url){
		var duixin = this;
		console.log('title',title);
		this.mpsanshow = true;
		duixin.mpsanurl = url;
		duixin.mpsantitle = title;
		
	},
	audioPlay(event){
		let _this = this;
		//console.log('refs',event);
		// 获取$refs对象的所有属性（即引用名称）  
		const refNames = Object.keys(this.$refs);
		// 过滤出引用名为"bbb"和"ccc"的组件  refName !== 'ccc125' !/`event`|privacy|hbComment/.test(refName)
		const filteredRefs = refNames.filter(refName => refName !== 'privacy' && refName !== 'hbComment' && refName !== 'audio' && refName !== event);  
		//console.log('refNames',filteredRefs);
		// 循环遍历引用名称  
		filteredRefs.forEach((refName) => {  
		  // 获取对应的引用对象（即子组件实例）
		  this.$refs[refName][0].zanting(event);
		  //const refObject = this.$refs[refName][0]; 
		  // 在这里可以对refObject进行操作，例如调用方法或访问数据属性等  
		  //console.log(refName, refObject);  
		}); 
	
	},
	//下载付款
	fukuan(id){
		uni.showToast({
			title: "请联系客服",
			icon: 'success',
			duration: 2000
		});
	},
	getWeixinFengxiangTus(){
		var duixin = this;
		console.log('duixin000tieids',duixin.tieids); 
		var getWeixinfengxiangtuRequest = wxRequest.getRequest(Api.getWeixinfengxiangtu(duixin.tieids));
		getWeixinfengxiangtuRequest.then(response => {
			if (response.data.code == 1) {
			  
			  duixin.fenxiangtu = response.data.data;
			  /*#ifdef H5*/
			  duixin.getWeixinFenxiangMiyueData(response.data.data);
			  /*#endif*/
			  
			  //console.log('fenxiangtu',duixin.fenxiangtu.title); 
			} else {
			  duixin.setData({
				displaySwiper: "none"
			  });
			}
		});
		
	},
	//会员信息
	getYonghuXinxi(uid) {
		var duixin = this; 
		var getYonghuXinxiRequest = wxRequest.getRequest(Api.getYonghuXinxi(uid));
		getYonghuXinxiRequest.then(response => {
			if (response.data.code == 1) {
			  duixin.yonghuXinxi = response.data.data
			} else {
			  duixin.setData({
				displaySwiper: "none"
			  });
			}
		});
	},
	// 微信分享密钥
	getWeixinFenxiangMiyueData(data){
		var duixin = this;
		//console.log('data000',data); 
		var danqianurls = uni.getLaunchOptionsSync();
		//var danqianurls = '/'+danqianurls.path+'?id='+danqianurls.query.id;
		var danqianurls = '/'+danqianurls.path;
		//decodeURIComponent(window.location.href)
		//const url = decodeURIComponent(window.location.href.split('#')[0]);
		const url = decodeURIComponent(window.location.href);
		//const url = decodeURIComponent('https://duixin.cc');
		var urljia = danqianurls;
		console.log('urljia',urljia); 
		console.log('url123',url); 
		var titles = duixin.tiezineirong.title;
		if(titles){
			var title = titles;
		} else {
			var title = duixin.tiezineirong.neirong;
		}
		if(data && data.tupian == 0){
			var tupian = duixin.www && duixin.www.logoico;
		} else {
			var tupian = data && data.tupian;
		}
		
		//console.log('tupian001',tupian); 
		var getWeixinfengxiangmiyueRequest = wxRequest.getRequest(Api.getWeixinfengxiangmiyue(url));
		getWeixinfengxiangmiyueRequest.then(response => {
			if (response.data.code == 1) {
				
			  var weixin = response.data.data;
			  //console.log('data',data); 
			  duixin.weixinfenxiangmiyue = response.data.data
				duixin.$wx.config({
				  debug: false,//true false
				  appId: weixin.appId,
				  timestamp: weixin.timestamp,
				  nonceStr: weixin.nonceStr,
				  signature: weixin.signature,
				  jsApiList: [
				    // 所有要调用的 API 都要加到这个列表中
				    
				    // 这里需要自己按微信文档来写参数
				    "updateAppMessageShareData",  
					"updateTimelineShareData",
					'checkJsApi', //判断当前客户端版本是否支持指定JS接口  
					'onMenuShareAppMessage', //分享接口  
					'getLocation', //获取位置  
					'openLocation', //打开位置  
					'scanQRCode', //扫一扫接口  
					'chooseWXPay', //微信支付  
					'chooseImage', //拍照或从手机相册中选图接口  
					'previewImage', //预览图片接口  
					'uploadImage' //上传图片  
				  ]
				});
				duixin.$wx.ready(function () {
				     // 自定义“分享给朋友”及“分享到QQ”按钮的分享内容
				     duixin.$wx.updateAppMessageShareData({ 
				      title: data.title, // 分享标题
				      desc: data.jianjie, // 分享描述
				      link: url, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
						imgUrl: tupian, // 分享图标
				      success: function () {
				        // 设置成功
				      },
					    complete:function(argv){
					        
					    }
				    });
				    //自定义“分享到朋友圈”及“分享到QQ空间”按钮的分享内容
				    duixin.$wx.updateTimelineShareData({
				      title: data.title, // 分享标题
					  desc: data.jianjie, // 分享描述
				      link: url, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
				      imgUrl: tupian, // 分享图标
				      success: function () {
				        // 设置成功
						//console.log('weixinmiyue2222',duixin.www.meta_title); 
				      }
				    });
				});
				duixin.$wx.error(function(res){
				  console.log('weixinres',res); 
				});
				
			} else {
			  duixin.setData({
				displaySwiper: "none"
			  });
			}
		});
	},
	// 判断端口
	duankoudata(){
		var duixin = this;
		let ua = uni.getSystemInfoSync().platform;
		//console.log('duankou',ua);
		if(/(iPhone|iPad|iPod|ios)/i.test(ua)){
		  // 苹果
			duixin.duankou = false;
		} else if(/android/i.test(ua)){
		  // 安卓
			duixin.duankou = true;
		} else {
		  // 其他
			duixin.duankou = true;
		}
	},
	//复制采集url
	caijiurl(data){
		// #ifdef MP
		    uni.setClipboardData({
		    	data: data,
		    	success: () =>
		    		uni.showToast({
		    			title: '链接已复制'
		    		})
		    })
		// #endif
		// #ifdef APP-PLUS || H5
		/*uni.navigateTo({
			url: data
		})*/
		window.location.href = data;
		/*uni.navigateTo({
		  url: `/pages/tiezi/url?urls=${data}`
		})*/
		// 
		/*uni.showToast({
			title: '链接已复制'
		})*/
		console.log('fuzhi',data);
		// #endif
		
	},
	//拉黑
	lahei(e){
		var duixin = this;
		if(e.zhi==1){
			duixin.postLaheiyonghuData(e.value); //拉黑用户
		} else {
			duixin.postPingbiTieziData(e.value); //拉黑帖子
		}
	},
	//拉黑用户接口
	postLaheiyonghuData(uid){
		var duixin = this;
		var datas = "touid="+uid;
		var getLaheiyonghuRequest = wxRequest.postRequest(Api.getLaheiyonghu(duixin.uid,duixin.keycode),datas);
		getLaheiyonghuRequest.then(response => {
			if(response.data.code == 1){
				uni.showToast({
					title: response.data.msg,
					duration: 1000
				});
			} else if (response.data.code == 2) {
				uni.showToast({
					title: response.data.msg,
					duration: 1000
				});
			}
		});
	},
	// 屏蔽帖子
	postPingbiTieziData(tid){
		var duixin = this;
		var datas = "tid="+tid;
		var getLaheitieziRequest = wxRequest.postRequest(Api.getLaheitiezi(duixin.uid,duixin.keycode),datas);
		getLaheitieziRequest.then(response => {
			if(response.data.code == 1){
				uni.showToast({
					title: response.data.msg,
					duration: 1000
				});
			} else if (response.data.code == 2) {
				uni.showToast({
					title: response.data.msg,
					duration: 1000
				});
			}
		});
	},
	// 屏蔽评论df
	postPingbiPinglunData(pid){
		var duixin = this;
		var datas = "pid="+pid;
		var getLaheipinglunRequest = wxRequest.postRequest(Api.getLaheipinglun(duixin.uid,duixin.keycode),datas);
		getLaheipinglunRequest.then(response => {
			if(response.data.code == 1){
				uni.showToast({
					title: response.data.msg,
					duration: 1000
				});
			} else if (response.data.code == 2) {
				uni.showToast({
					title: response.data.msg,
					duration: 1000
				});
			}
		});
	}
  }
};
</script>
<style lang="scss">
@import "./tiezi.css";
/* #ifdef H5 */
::v-deep img {
    max-width: 100%;
	border-radius: 10px;
}
::v-deep  p {
	    display: block;
	    margin-top: 5px;
		margin-bottom:5px;
		line-height:30px !important;
		font-size: 18px;
} 
::v-deep pre {
	padding: 10px;
	background-color: #262626;
	border-radius: 10px;
	color: #eaeaea;
}
/* #endif */

</style>